<style src="./index.scss" lang="scss" scoped rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
    mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.List],
    components: {
        StateIcon: async () =>
            Vue.extend(
                await Vue.prototype.$vFN.Components.Base.StateIcon()
            ),
            
    },
    props: {
        // 使用者window实例 必定义
        appWindow: {
            type: Object,
            default: null,
        },
        // 接口列表
        apiConfig: {
            type: Object,
            default: {
                // 商品列表分页
                goodsList: {
                    url: "admin/category/index",
                    domain: "STORE_MAIN_DOMAIN",
                },
            },
        },

        selected: {
            type: Object,
            default: null,
        },
    },
    data() {
        return {
            // 页面接口地址
            apiUrl: {
                list: null,
            },

            // 表格查询数据
            mixinList_tableSearchData: {
                name: "",
            },
        };
    },
    computed: {},
    methods: {
        // 初始化
        async init() {
            // 显示窗口
            this.mixinList_refreshData();
        },

        isSelect(item_) {
            if (
                this.selected.path == "/packStore/storeList/index" &&
                item_.id ==
                    this.$vFN.Utils.optionalChain(this.selected, "query.groupId")
            ) {
                return true;
            } else {
                return false;
            }
        },
        select(item_) {
            console.error("item_", item_);
            // 未上架商品
            if(item_.publishStatus==1){
                return
            }
            this.$emit("change", {
                name: "商品链接-" + item_.name,
                groupId: item_.id,
                path: "/packStore/storeList/index",
            });
        },
    },
    watch: {},
    mounted() {
        this.apiUrl = {
            list: {
                url: this.apiConfig.goodsList.url,
                domain: this.apiConfig.goodsList.domain,
            },
        };
        this.init();
    },
    beforeCreate() {},
};
</script>
